Skip to content

fix(health,argus): restore cost_health + drop stripe test-mode events#27

Merged
stackbilt-admin merged 1 commit intomainfrom
fix/health-cost-livemode
Apr 23, 2026
Merged

fix(health,argus): restore cost_health + drop stripe test-mode events#27
stackbilt-admin merged 1 commit intomainfrom
fix/health-cost-livemode

Conversation

@stackbilt-admin
Copy link
Copy Markdown
Member

Summary

Two Co-Founder Brief regressions surfaced during 2026-04-11 triage, both landing in aegis-core (active code path — daemon shadow is dead code).

1. cost_health regression (closes #26)
`/health?format=json` lost its `cost_health` field during the kernel shadow collapse. Re-added `loadCostHealth()` which reads `cost_budgets` + latest `cost_snapshot` per provider and shapes the response per the original CHANGELOG #373 contract (`spend_usd`, `monthly_budget`, `threshold_tier`, `projected_depletion_days`, `burn_rate_per_hour`). Safe against fresh installs — returns `null` if tables don't exist.

2. Stripe livemode filter (closes #25)
`argus-notify` was queueing test-mode Stripe events into `digest_sections`, causing the daily brief to fire "Revenue is flowing" against fake MRR. `argus-actions` already had the livemode check (line 330) but `argus-notify` didn't — the two layers disagreed. Fixed pre-classification so rows still mark `notified=1` and don't re-scan.

Test plan

  • `curl /health?format=json | jq .cost_health` returns per-provider object after deploy
  • Each entry has all 5 CHANGELOG-documented fields
  • Queue a test-mode `checkout.session.completed` webhook → event does NOT land in `digest_sections` (marked notified=1 and skipped)
  • Queue a `livemode: true` event → normal flow
  • Daily Co-Founder Brief no longer reports "Revenue is flowing" while real MRR is $0

Closes #26
Closes #25

🤖 Generated with Claude Code

@stackbilt-admin
Copy link
Copy Markdown
Member Author

Charter failure here is the same Install dependencies break as PR #22 — filed as #31. Fixes the cost_health regression from #26, so merging it unblocks two open issues once #31 is resolved.

stackbilt-admin added a commit that referenced this pull request Apr 23, 2026
Charter CI has been failing on every PR since the workflow was added in
65780bd (7/7 runs red). This fixes the three compounding root causes so
the check actually gates what it claims to gate.

## Problems

1. **Install step failed with ENOENT.** Workflow ran `npm ci` at repo root,
   but the repo only had a 5-line stub `package-lock.json` and no
   `package.json`. The application lives in `web/`; the root install was
   never wired for Charter's governance CLI.

2. **`@stackbilt/cli@0.10.0` is unpublishable.** Its npm tarball carries
   `workspace:^` protocol deps that can't be resolved outside the Charter
   monorepo. Pin to `^0.9.2` until upstream publishes a clean 0.10.x.

3. **Policy gates failed on clean checkouts.**
   - `validate` (exit 1): `requireTrailers: true` + `trailerThreshold:
     HIGH` + no trailer convention in this repo's history = every PR red.
     Dependabot PRs (#22) cannot possibly author trailers. Softened to
     `requireTrailers: false` — charter still surfaces suggestions, but
     doesn't block. Re-enable once the repo adopts a trailer convention.
   - `doctor --adf-only` (exit 1): `.ai/manifest.adf` referenced
     `advisory-board.adf` (Atlas/Mercer/Sloan advisor modules), which
     belongs in the daemon, not the OSS core. Removed the reference.

## Fixes

- Add root `package.json` scoped to governance tooling (private, name
  `aegis-oss-governance`, sole devDep `@stackbilt/cli@^0.9.2`)
- Generate proper `package-lock.json` so `npm ci` works in CI
- Relax `.charter/config.json` trailer gate to non-blocking
- Remove `advisory-board.adf` (Stackbilt-specific) from ADF manifest

## Verified locally

All 5 Charter steps exit 0 against this branch:

  validate=0 drift=0 doctor=0 adf-evidence=0 audit=0

## Follow-ups

- Unblock PR #22 (8 dependabot advisories) via rebase once this lands
- Unblock PR #27 (cost_health regression, #26) via rebase once this lands
- File charter-repo bug for `@stackbilt/cli@0.10.0` workspace protocol
  publish failure
- Consider re-authoring a trailer convention and re-enabling strict mode
  once this repo + daemon both adopt it

Refs: #31, #22, #27

Co-authored-by: Aegis <Aegis@stackbilt.dev>
Two Co-Founder Brief regressions surfaced 2026-04-11 triage:

1. /health?format=json no longer exposed cost_health (lost during
   kernel shadow collapse). Re-added loadCostHealth() which reads
   cost_budgets + latest cost_snapshot per provider and shapes the
   per-provider response per the original CHANGELOG #373 contract
   (spend_usd, monthly_budget, threshold_tier, projected_depletion_days,
   burn_rate_per_hour). Safe against fresh installs where cost tables
   don't yet exist (returns null).

2. argus-notify queued Stripe test-mode events (livemode: false) into
   digest_sections, causing the daily brief to trip the "Revenue is
   flowing" take against fake MRR. argus-actions already had this check
   (line 330) but argus-notify didn't — the two layers disagreed. Now
   filtered pre-classification; rows still get marked notified=1 so we
   don't re-scan them.

Closes #26, #25.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@stackbilt-admin stackbilt-admin force-pushed the fix/health-cost-livemode branch from 7e3dff7 to 2c9ac21 Compare April 23, 2026 21:58
@stackbilt-admin stackbilt-admin merged commit d7ed179 into main Apr 23, 2026
2 checks passed
@stackbilt-admin stackbilt-admin deleted the fix/health-cost-livemode branch April 23, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cost_health field regression: missing from /health endpoint response Co-Founder Brief 'Revenue is flowing' line ignores Stripe livemode flag

1 participant